package com.example.mymall.repository.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mymall.dao.UserMapper;
import com.example.mymall.entity.UserEntity;
import com.example.mymall.entity.UserGoodsCartVO;
import com.example.mymall.repository.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl extends ServiceImpl<UserMapper,UserEntity> implements UserService {

    @Autowired
    private UserMapper userMapper;

    public IPage<UserEntity> selectUserPage(int currentPage, int pageSize){
        Page<UserEntity> page = new Page<>(currentPage, pageSize);
        return userMapper.selectPage(page, null);
    }

    public List<UserGoodsCartVO> test() {
        return userMapper.selecttext();
    }

    public IPage<UserGoodsCartVO> getCartDetailAll(int currentPage, int pageSize){
        Page<UserGoodsCartVO> page = new Page<>(currentPage, pageSize);
        return userMapper.selectCartDetailAll(page);
    }

}
